import { Navigate } from "react-router-dom";
import Login from "../components/Login";
import Main from "../components/Main";
import About from "../components/Main/about";
import Home from "../components/Main/home";

// children这里是二级路由,注意二级路由要包裹在一级路由中,依次类推
// children表示子组件,是数组,可能有多个,每一个长的和外面是一样的
const routes =[
   {
  path:"/login",
  element:<Login/>
},
  {
    path:"/main",
    element:<Main/>,
    children:[
      {
        path:"/main/home",
        element:<Home/>
      },
      {
        path:"/main/about",
        element:<About/>
      },

    ]
  },
 
  {
    path:"*",
    element:<Main/>
  },
  {
    path:"/",
    element:<Navigate to="/login"/>
  }
]

export default routes